﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ProtoBuf.Message;

namespace UI
{
    public class UIOtherPlayerData
    {
        public int fightPower;
        public string playerName;
        public Dictionary<int, UIHeroFormation> formations = new Dictionary<int, UIHeroFormation>();
        
        public void InitData(FormationSimpleInfo data)
        {
            fightPower = data.fightPower;
            playerName = data.name;

            formations.Clear();
            formations[1] = new UIHeroFormation(1, 1, null);
            formations[2] = new UIHeroFormation(2, 2, null);
            formations[3] = new UIHeroFormation(3, 3, null);
            formations[4] = new UIHeroFormation(4, 4, null);

            foreach (var item in data.formationItemInfoList)
            {
                //UIHeroFormation formation = new UIHeroFormation();
                //formation.InitData(item);
                formations[item.formatPos].InitData(item);// = formation;
            }
        }
    }
}
